<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        
        class A {
            constructor(name, age) {
                this.name = name;
                this.age = age;
            }
            showName() {
                alert(this.name);
            }
            showAge() {
                alert(this.age);
            }
            x() {
                return 10;
            }
        };

        class B extends A {
            constructor(name, age, id) {
                super(name, age);
                this.id = id;
            }
            x() {
                return super.x() + 10;
            }
        }

        let a = new A('阿飞', 22);
        let b = new B('朱雀', 55, 1);

        // b.showName();

        console.log(a);
        console.log(b);
        console.log(a.x())
        console.log(b.x());
    </script>
</body>
</html>